package xiegd.study.TransActionTest.propagationRequired;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import xiegd.study.TransActionTest.UserMapper;
import xiegd.study.source.Mapping.UserInfoMapper;

import java.io.IOException;
import java.io.Reader;

public class PropagationRequiredTest1 {
    private SqlSession sqlSession;
    @BeforeEach
    public  void beReady(){
        String resource = "mybatis.xml";
        System.out.println("我被启动了；；");
        Reader reader;
        try {
            reader = Resources.getResourceAsReader(resource);
            SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
            sqlSession = sqlSessionFactory.openSession();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Test
    public void mytest(){
        UserMapper userMapper = sqlSession.getMapper(UserMapper.class);
    }
}
